package com.air.common.vo;

import java.io.Serializable;
import java.util.HashMap;
import net.sf.json.JSONObject;

public class ResponseVO implements Serializable{
	
	private boolean executeResult;
	private String  errCode;
	private Exception exception;
	private String  viewName;
	private HashMap<String, Object> objects;
	

	public ResponseVO(){
		this.executeResult = true;
		this.errCode = null;
		objects  = new HashMap<String, Object>();
		this.exception = null;
		this.viewName = null;
	}
	
	public ResponseVO(HashMap<String, Object> objects){
		this.executeResult = true;
		this.errCode = null;
		this.objects = objects;
		this.exception = null;
		this.viewName = null;
	}
	
	public boolean isExecuteResult() {
		return executeResult;
	}
	public void setExecuteResult(boolean executeResult) {
		this.executeResult = executeResult;
	}
	public String getErrCode() {
		return errCode;
	}
	public void setErrCode(String errCode) {
		this.errCode = errCode;
	}
	public HashMap<String,?> getObjects() {
		return objects;
	}
	public void setObjects(HashMap<String,Object> objects) {
		this.objects = objects;
	}
	
	
	public JSONObject toJsonFormat(){
		return JSONObject.fromObject(this);
	}
	public Exception getException() {
		return exception;
	}
	public void setException(Exception exception) {
		this.exception = exception;
	}

	public String getViewName() {
		return viewName;
	}

	public void setViewName(String viewName) {
		this.viewName = viewName;
	}
	
	public void addObject(String key,Object value){
		if (objects==null){
			objects  = new HashMap<String, Object>();
		}
		this.objects.put(key, value);
	}
	
	
	
}
